<aside class="use-tit event-item clearfix ">
  <h4 class="text-left col-xs-9">Công việc </h4>
  <div class="text-right col-xs-3 col-right">
      <?php echo CHtml::ajaxLink('Thêm công việc',
                Yii::app()->createUrl('/Users/profiles/addwork'),
                array(
                    'type' => 'POST',
                    'dataType' => 'json',
                    'success' => 'function(data)
                    {
                       $("#use-add-work").show();
                       $("#use-add-work").html(data.views);
                    }'
                ),
                 array(
                  'class'=>'user-link-add',
                  'href' => Yii::app()->createUrl('/Users/profiles/addwork'))
                 ); ?>
  </div>
</aside>

<div class="use_hr_for"></div>
 
  <div id="use-all-work">
  <?php 
  	foreach ($works as $work) {
  		echo $this->renderPartial('_viewonework',array('work'=>$work),false,true);
  	}
   ?>
  </div>
 
   <div id="use-add-work" style="display:none;"></div>
<div class="use_hr_for"></div>
<script type="text/javascript">
  function callLinkUpdate (id) {
    $.ajax({
              type: "POST",
              url: "<?php echo Yii::app()->createUrl('/Users/profiles/updatework');?>",
              data: {id:id},
              // cache: false,
              success: function(data){
                $("#use-add-work").html("");
                $("#use-add-work").html(data);
                $("#use-add-work").show();
              },
            });
  }
  function callDeleteWork(id) {
    if (confirm("Bạn có xóa công việc này không?")) {
      $.ajax({
                    type: "POST",
                    url: "<?php echo Yii::app()->createUrl('/Users/profiles/deletework');?>",
                    data: {id:id},
                    // cache: false,
                    success: function(data){
                      $("#use-view-work"+id).remove();
                    },
            });
    };  
  }
</script>